package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 消息模板表（短信、邮件、站内信）
 * </p>
 *
 * @author liuxiaobai
 * @since 2021-08-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_msg_template")
@ApiModel(value = "MsgTemplate", description = "消息模板表（短信、邮件、站内信）")
@AllArgsConstructor
public class MsgTemplate extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    @ApiModelProperty(value = "")
    @TableField(value = "project_id")
    @Excel(name = "")
    private Long projectId;

    /**
     * email、sms、notice
     */
    @ApiModelProperty(value = "email、sms、notice")
    @Size(max = 32, message = "email、sms、notice长度不能超过32")
    @TableField(value = "msg_type", condition = LIKE)
    @Excel(name = "email、sms、notice")
    private String msgType;

    /**
     * 模版类型
     */
    @ApiModelProperty(value = "模版类型")
    @Size(max = 255, message = "模版类型长度不能超过255")
    @TableField(value = "temp_type", condition = LIKE)
    @Excel(name = "模版类型")
    private String tempType;

    /**
     * 模版标题
     */
    @ApiModelProperty(value = "模版标题")
    @Size(max = 255, message = "模版标题长度不能超过255")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "模版标题")
    private String title;

    /**
     * 邮件主题中文
     */
    @ApiModelProperty(value = "邮件主题中文")
    @Size(max = 255, message = "邮件主题中文长度不能超过255")
    @TableField(value = "subject", condition = LIKE)
    @Excel(name = "邮件主题中文")
    private String subject;

    /**
     * 邮件主题英文
     */
    @ApiModelProperty(value = "邮件主题英文")
    @Size(max = 255, message = "邮件主题英文长度不能超过255")
    @TableField(value = "en_subject", condition = LIKE)
    @Excel(name = "邮件主题英文")
    private String enSubject;

    /**
     * 模板内容中文
     */
    @ApiModelProperty(value = "模板内容中文")
    @Size(max = 65535, message = "模板内容中文长度不能超过65535")
    @TableField(value = "content", condition = LIKE)
    @Excel(name = "模板内容中文")
    private String content;

    /**
     * 模板内容英文
     */
    @ApiModelProperty(value = "模板内容英文")
    @Size(max = 65535, message = "模板内容英文长度不能超过65535")
    @TableField(value = "en_content", condition = LIKE)
    @Excel(name = "模板内容英文")
    private String enContent;

    /**
     * 邮件webpower模板ID
     */
    @ApiModelProperty(value = "邮件webpower模板ID")
    @TableField(value = "mailing_id")
    @Excel(name = "邮件webpower模板ID")
    private Integer mailingId;

    /**
     * 是否删除
     */
    @ApiModelProperty(value = "是否删除")
    @TableField(value = "is_delete")
    @Excel(name = "是否删除")
    private Integer isDelete;

    /**
     * 是否启用
     */
    @ApiModelProperty(value = "是否启用")
    @TableField(value = "is_enable")
    @Excel(name = "是否启用")
    private Integer isEnable;


    @Builder
    public MsgTemplate(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    Long projectId, String msgType, String tempType, String title, String subject, 
                    String enSubject, String content, String enContent, Integer mailingId, Integer isDelete, Integer isEnable) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.projectId = projectId;
        this.msgType = msgType;
        this.tempType = tempType;
        this.title = title;
        this.subject = subject;
        this.enSubject = enSubject;
        this.content = content;
        this.enContent = enContent;
        this.mailingId = mailingId;
        this.isDelete = isDelete;
        this.isEnable = isEnable;
    }

}
